import pymongo
from lina.mongodb import db
from lina.service.BaseService import BaseService


class PhaseService(BaseService):

    def __init__(self):
        self.table_name = 'phase'
        super().__init__()

    
    def get_all_phase(self):
        obj_list = []
        for item in db()[self.table_name].find().sort([('sort_index', pymongo.ASCENDING)]):
            obj_list.append(item)
        return obj_list
